package top.appx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.appx.entity.UserGroupEntity;
import top.appx.service.UserGroupService;
import top.appx.vo.Pager;
import top.appx.vo.ResultVO;
import top.appx.vo.UserGroupVO;

import javax.annotation.Resource;

/**
 * Created by zwy on 2015-5-21.
 */
@Controller
public class UserGroupController {

    @Resource
    private UserGroupService userGroupService;
    @RequestMapping(value= "userGroup/controller",params = "action=queryByPage")
    @ResponseBody
    public Object queryByPage(UserGroupEntity userGroup,int page,int rows){
        Pager<UserGroupVO> pager = userGroupService.queryByPage(userGroup,page,rows);
        return pager;
    }

    @RequestMapping(value="userGroup/controller",params = "action=save")
    @ResponseBody
    public Object save(UserGroupEntity user){
        userGroupService.save(user);
        return new ResultVO();
    }

    @RequestMapping(value="userGroup/controller",params = "action=delete")
    @ResponseBody
    public Object delete(UserGroupEntity user){
        userGroupService.delete(user);
        return new ResultVO();
    }


}
